#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<cstring>
using namespace std;
typedef long long LL;
const int N = 110;
int arr[N];
int b[N];
int n, m;
priority_queue<int, vector<int>, greater<int>>q, p;
int main()
{
	int t;
	cin >> t;
	while (t--) {
		cin >> n >> m;
		memset(arr, 0, sizeof(arr));
		memset(b, 0, sizeof(b));
		for (int i = 1; i <= n; i++) {
			cin >> arr[i];
		}
		LL ans = 0;
		LL ans1 = 0;
		for (int i = 1; i <= m; i++) {
			cin >> b[i];
			ans1 += b[i];
		}
		//int sum = 0;
		//int ma = max(n, m);
		//for (int i = 1; i <= ma; i++) {
		//	int t = q.top();
		//	//cout << "t==" << t << endl;
		//	q.pop();
		//	sum++;
		//	if (sum <= m) {
		//		ans += b[i];
		//		q.push(b[i]);
		//	}
		//	else {
		//		ans += t;
		//	}
		//}
		//cout << ans << endl;
		sort(arr + 1, arr + n + 1);
		if (n < m) {
			int a = 0;
			for (int i = m; i >= 1; i--) {
				ans += b[i];
				a++;
				if (a == n) {
					break;
				}
			}
		}
		else if (n == m) {
			ans = ans1;
		}
		else {
			ans = ans1;
			for (int i = m + 1; i <= n; i++) {
				ans += arr[i];
			}
		}
		cout << ans << endl;
	}
	return 0;
}